package org.firebug.easycode.conf;

import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * http://localhost:8080/{context-path}/swagger-ui.html
 */
@EnableSwagger2
public class Swagger2Conf {
    @Bean
    public Docket docket() {
        ApiInfo info = new ApiInfoBuilder()
                .contact(new Contact("{联系人}", "{url}", "{联系人邮箱}"))
                .title("{自定义标题}")
                .version("{自定义版本}")
                .build();
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(info)
                .select()
                .apis(RequestHandlerSelectors.basePackage("org.firebug.easycode.web"))
                .paths(PathSelectors.any())
                .build();
    }
}